﻿<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" ValidateRequest="false"   CodeBehind="PostsManage.aspx.cs" Inherits="eBlog.Web.Admin.PostsManage" %>
<%@ Import Namespace="DBScript" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=7" />
<link href="resources/css/style.css" rel="stylesheet" type="text/css" />
<script src="resources/scripts/common.js" type="text/javascript"></script>
<script src="resources/scripts/admincp.js" type="text/javascript"></script>
<script src="resources/scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="resources/scripts/jquery.tagto.js" type="text/javascript"></script>
<link href="../Assets/Editors/kindeditor-4.0-beta/themes/default/default.css" rel="stylesheet" type="text/css" />
<script src="../Assets/Editors/kindeditor-4.0-beta/kindeditor-min.js" type="text/javascript"></script>
<script src="../Assets/Editors/kindeditor-4.0-beta/lang/zh_CN.js" type="text/javascript"></script>
<script type="text/javascript">
    KindEditor.ready(function (K) {
        var editor1 = K.create('#txtContent', {
            uploadJson: '/Assets/Editors/kindeditor-4.0-beta/plugins/filemanager/upload_json.ashx',
            fileManagerJson: '/Assets/Editors/kindeditor-4.0-beta/plugins/filemanager/file_manager_json.ashx',
            allowFileManager: true,
            afterCreate: function () {
                var self = this;
                K.ctrl(document, 13, function () {
                    self.sync();
                    K('form[name=addpostForm]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function () {
                    self.sync();
                    K('form[name=addpostForm]')[0].submit();
                });
            }
        });

        var editor2=  K.create('#txtSummary', {
            resizeType: 1,
            height: '200px',
            allowPreviewEmoticons: false,
            allowImageUpload: false,
            items: [
			'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', '|', 'emoticons', 'link']
        });
       
    });

</script>

<script type="text/javascript">
    (function ($) {
        $(document).ready(function () {
            $("#taglist").tagTo("#<%=txtTag.ClientID %>", ",", "selected");
        });
    })(jQuery);
</script>
<style type="text/css">
    /*tag choose*/
    .selected
    {
        background: #c00;
        color: #fff;
    }
</style>
</head>

<body>


<div id="append_parent"></div>
<div class="container" id="cpcontainer">
<script type="text/JavaScript">    parent.document.title = '管理中心 - 文章管理 '; if (parent.$('admincpnav')) parent.$('admincpnav').innerHTML = '全局&nbsp;&raquo;&nbsp;管理 文章管理';</script>

<div class="floattop">
<div class="itemtitle">
	<h3>文章管理</h3>
    <ul class="tab1" id="submenu">
        <li class="current"><a href="PostsManage.aspx"><span>文章列表</span></a></li>
        <li class="current"><a href="PostsManage.aspx?action=add"><span>发布文章</span></a></li>
    </ul>
</div>
</div>

<div class="floattopempty"></div>

<form name="addpostForm" id="addpostForm" runat="server">
<input type="hidden" name="anchor" value="" />
<input type="hidden" ID="Referrer" runat="server" />

<asp:Panel ID="edit" runat="server" Visible="false" EnableViewState="false">
<div class="addpost" id="base">
	<div class="title">
        <p>
            标题:
        </p>
        <p>
        <asp:TextBox ID="txtTitle" runat="server" class="txt" Width="50%"></asp:TextBox>
        </p>
            
    </div>

	<div class="content">
        <p>内容:</p>
        <p>
	    <asp:TextBox ID="txtContent" runat="server" mce_editable="true" class="txt" TextMode="MultiLine" Width="80%" Height="600"></asp:TextBox>
	    </p>
    </div>
    <div class="summary">
        <p><label  class="label" for="<%=txtSummary.ClientID %>">摘要: <a href="javascript:void(0);" onclick="createSummary('full');">从正文提取全部</a>/<a href="javascript:void(0);" onclick="createSummary('part');">部分</a></label></p>
        <p>
            <asp:TextBox ID="txtSummary"  runat="server" class="txt" TextMode="MultiLine" Width="80%" Height="50"></asp:TextBox>
           
        </p>
    </div>
    <div class="type">
        <p>分类:</p>
        <p>
            <asp:DropDownList ID="ddlType" runat="server" Width="60%">
            </asp:DropDownList>
        </p>
    </div>
    <div class="tag">
        <p><label  class="label" for="<%=txtTag.ClientID %>">标签:<span  class="gray small"  > (多个标签用逗号隔开[选填])</span></label></p>
        <p>
            <asp:TextBox ID="txtTag" runat="server" class="txt" Width="60%"></asp:TextBox>
              <a  href="###" onclick="showTag();" >查看常用标签↓</a>
             <div id="taglist" style=" border:2px solid #ccc;display:none;  line-height:135%; padding:3px ; width:700px;  ">
            <%
                IDBBase dal = DBFactory.GetDbProvider(); //初始化数据工厂
                System.Collections.Generic.List<eBlog.Entity.Terms> tagList = dal.Where("Type=2").GetList<eBlog.Entity.Terms>();
                foreach (eBlog.Entity.Terms tag in tagList)
              { %>
              
                  <a href="###" style="padding-left:3px;"><%=tag.Name %></a><span class="gray small">(<%=tag.Count %>)</span>
                   
            <%} %>
            
            <%if (tagList.Count == 0)
              { %>
              暂无
            <%} %>
            
        </div>
             <script type="text/javascript">
                function showTag() {
                    if (document.getElementById('taglist').style.display == '') {
                        document.getElementById('taglist').style.display = 'none';
                    } else {
                        document.getElementById('taglist').style.display = '';
                    }
                }
            </script>
        </p>
    </div>
   <div class="options">
     <p>
        <asp:CheckBox ID="chkTopShow" Text="是否轮播" runat="server" Checked="False" CssClass="checkItem" />
        <asp:CheckBox ID="chkCommentStatus" Text="禁止评论" runat="server" Checked="False" CssClass="checkItem" />
        <asp:CheckBox ID="chkRecommend" Text="是否推荐" runat="server" Checked="False" CssClass="checkItem" />
        <asp:CheckBox ID="chkTopStatus" Text="置顶" runat="server" Checked="False" CssClass="checkItem" />
    </p>
   </div>

    <div class="btnsaves">
        <asp:Button ID="btnSave" runat="server" Text="保 存" class="btn" OnClick="btnSave_Click">
        </asp:Button>
        <span style="margin-left: 20px"></span>
        <input type="button" value="返 回" id="goback" class="btn" onclick="javascript:history.go(-1)" />
    </div>
</div>

</asp:Panel>

<%--列表容器--%>
<asp:Panel ID="list" runat="server" Visible="false" EnableViewState="false">
<table class="tb tb2 ">
<tr><th colspan="15" class="partition">共<strong> <%=ListCount %> </strong>篇文章<a href="" class="act lightlink normal"></a></th></tr>

<tr class="header">
    <th></th>
	<th>序号</th>
	<th>标题</th>
    <th>分类</th>
	<th>作者</th>
	<th>评论状态</th>
	<th>评论数</th>
	<th>状态</th>
	<th>是否置顶</th>
    <th>是否轮播</th>
	<th>创建时间</th>
	<th>管理选项</th>
</tr>

<asp:Repeater ID="RPLIST" runat="server" >
<itemtemplate>
<tr class="hover">
	<td class="td25"><input type="checkbox" name="checkAllID" value="<%#Eval("ID") %>" class="checkbox"></td>
	<td><%#Eval("ID") %></td>
	<td><%#Eval("Title") %></td>
    <td><%#Eval("TypeID") %></td>
	<td><%#Eval("UserID") %></td>
	<td><%#Eval("CommentStatus") %></td>
	<td><%#Eval("CommentCount") %></td>
	<td><%#Eval("Status") %></td>
	<td><%#Eval("TopStatus") %></td>
    <td><%#Eval("TopShow") %></td>
	<td><%#Eval("CreateDate") %></td>
    <td>
        <a href="?action=edit&id=<%#Eval("ID") %>" class="act">编辑</a>
        <a href="?action=del&id=<%#Eval("ID") %>"  class="act" onclick="return confirm('数据删除不可恢复,确认删除吗？');">删除</a>
    </td>
</tr>
</itemtemplate>
</asp:Repeater>
<tr><td colspan="15"><div class="cuspages right"><div class="pg"><asp:Literal ID="PageNav" runat="server"></asp:Literal></div></div>
<div class="fixsel"><input type="checkbox" name="chkall" onclick="checkAll('prefix', this.form, 'checkAllID')" class="checkbox">删? &nbsp;
<input type="button" class="btn" id="checkAllDel" name="checkAllDel" value="提交" onclick="return confirm('确认选择批量删除吗？');"/></div>
</td></tr>
</table>
</asp:Panel>
<input type="hidden" ID="ErrCodeStr" runat="server" />
<script type="text/javascript">formShowErr("ErrCodeStr");</script>
</form>
</div>
<style type="text/css">
.addpost .title{  padding-top:15px; padding-left:20px;}
.addpost .content{ padding-top:15px; padding-left:20px;}
.addpost .summary{ padding-top:15px; padding-left:20px;}
.addpost .type{  padding-top:15px; padding-left:20px;}
.addpost .tag{  padding-top:15px; padding-left:20px;}
.addpost .options{  padding-top:15px; padding-left:20px;}
.addpost .btnsaves{  padding-top:15px; padding-left:20px;}
</style>
</body>
</html>
